package com.itheima.array;

import java.util.Scanner;

public class ArrayTest04 {
    public static void main(String[] args) {
        int[] arr = {19,28,37,37,46,50};
        Scanner sc = new Scanner(System.in);

        System.out.println("输入您要查找的数据:");
        int num =sc.nextInt();
        int index = -1;
        for (int i = 0; i < arr.length; i++) {
            if (num == arr[i]) {
                index = i;
                System.out.println("index = " + index);
            }
        }
        if(index == -1){
            System.out.println("index = " + index);
        }
    }
}
